/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80027
 Source Host           : localhost:3306
 Source Schema         : code_generator

 Target Server Type    : MySQL
 Target Server Version : 80027
 File Encoding         : 65001

 Date: 14/07/2022 10:41:56
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_code_db
-- ----------------------------
DROP TABLE IF EXISTS `t_code_db`;
CREATE TABLE `t_code_db` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `alias` varchar(50) DEFAULT NULL COMMENT '别名',
  `db_driver` varchar(255) DEFAULT NULL COMMENT '数据库驱动',
  `db_url` varchar(255) DEFAULT NULL COMMENT '数据库地址',
  `db_user_name` varchar(255) DEFAULT NULL COMMENT '数据库账户',
  `db_password` varchar(255) DEFAULT NULL COMMENT '链接密码',
  `db_type` varchar(255) DEFAULT NULL COMMENT '数据库类型',
  `status` varchar(50) DEFAULT NULL COMMENT '状态',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `version` int DEFAULT NULL COMMENT '版本',
  `deleted` int DEFAULT NULL COMMENT '逻辑删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='数据库链接信息\n';

-- ----------------------------
-- Records of t_code_db
-- ----------------------------
BEGIN;
INSERT INTO `t_code_db` (`id`, `alias`, `db_driver`, `db_url`, `db_user_name`, `db_password`, `db_type`, `status`, `create_time`, `update_time`, `version`, `deleted`) VALUES (1, 'demo', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql://localhost:3306/cm_erp_business?characterEncoding=utf8&useSSL=true&serverTimezone=Asia/Shanghai', 'root', '123456', 'mysql', NULL, '2022-07-14 09:38:51', '2022-07-14 09:38:51', 0, 0);
COMMIT;

-- ----------------------------
-- Table structure for t_code_field
-- ----------------------------
DROP TABLE IF EXISTS `t_code_field`;
CREATE TABLE `t_code_field` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `template_id` int DEFAULT NULL COMMENT '模板id',
  `field_type` varchar(50) DEFAULT NULL COMMENT '数据库类型',
  `java_type` varchar(50) DEFAULT NULL COMMENT 'JAVA类型',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `version` int DEFAULT NULL COMMENT '版本',
  `deleted` int DEFAULT NULL COMMENT '逻辑删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='字段类型表\n';

-- ----------------------------
-- Records of t_code_field
-- ----------------------------
BEGIN;
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (1, 1, 'bigint', 'Long', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (2, 1, 'binary', 'byte[]', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (3, 1, 'bit', 'Boolean', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (4, 1, 'blob', 'byte[]', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (5, 1, 'bool', 'Boolean', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (6, 1, 'boolean', 'Boolean', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (7, 1, 'char', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (8, 1, 'date', 'java.time.LocalDate', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (9, 1, 'datetime', 'java.time.LocalDateTime', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (10, 1, 'decimal', 'java.math.BigDecimal', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (11, 1, 'double', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (12, 1, 'enum', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (13, 1, 'float', 'Float', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (14, 1, 'int', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (15, 1, 'json', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (16, 1, 'longblob', 'byte[]', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (17, 1, 'longtext', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (18, 1, 'mediumblob', 'byte[]', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (19, 1, 'mediumint', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (20, 1, 'mediumtext', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (21, 1, 'numeric', 'java.math.BigDecimal', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (22, 1, 'real', 'Float', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (23, 1, 'set', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (24, 1, 'smallint', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (25, 1, 'text', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (26, 1, 'time', 'java.sql.Time', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (27, 1, 'timestamp', 'java.sql.Timestamp', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (28, 1, 'tinyblob', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (29, 1, 'tinyint', 'Boolean', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (30, 1, 'tinytext', 'Integer', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (31, 1, 'varbinary', 'byte[]', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (32, 1, 'varchar', 'String', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
INSERT INTO `t_code_field` (`id`, `template_id`, `field_type`, `java_type`, `create_time`, `update_time`, `version`, `deleted`) VALUES (33, 1, 'year', 'java.time.LocalDate', '2022-07-14 09:43:21', '2022-07-14 09:43:21', 0, 0);
COMMIT;

-- ----------------------------
-- Table structure for t_code_template
-- ----------------------------
DROP TABLE IF EXISTS `t_code_template`;
CREATE TABLE `t_code_template` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `template_type` varchar(255) DEFAULT NULL COMMENT '模板类型',
  `template_name` varchar(255) DEFAULT NULL COMMENT '模板名称',
  `template_desc` varchar(255) DEFAULT NULL COMMENT '模板描述',
  `user_id` int DEFAULT NULL COMMENT '用户id',
  `file_name` varchar(255) DEFAULT NULL COMMENT '文件名称',
  `template_path` varchar(255) DEFAULT NULL COMMENT '文件路径',
  `group_id` int DEFAULT NULL COMMENT '组id',
  `local_path` varchar(255) DEFAULT NULL COMMENT '本地路径',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user_id` int DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_user_id` int DEFAULT NULL COMMENT '修改人',
  `version` int DEFAULT NULL COMMENT '版本',
  `deleted` int DEFAULT NULL COMMENT '逻辑删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='模板\n';

-- ----------------------------
-- Records of t_code_template
-- ----------------------------
BEGIN;
INSERT INTO `t_code_template` (`id`, `template_type`, `template_name`, `template_desc`, `user_id`, `file_name`, `template_path`, `group_id`, `local_path`, `create_time`, `create_user_id`, `update_time`, `update_user_id`, `version`, `deleted`) VALUES (1, 'beetl', 'demo-前端', 'demo-前端', NULL, NULL, NULL, NULL, NULL, '2022-07-14 09:43:21', NULL, '2022-07-14 09:43:21', NULL, 0, 0);
COMMIT;

-- ----------------------------
-- Table structure for t_code_template_field
-- ----------------------------
DROP TABLE IF EXISTS `t_code_template_field`;
CREATE TABLE `t_code_template_field` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `template_id` int DEFAULT NULL COMMENT '模板id',
  `field_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'key',
  `field_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'value',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user_id` int DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_user_id` int DEFAULT NULL COMMENT '修改人',
  `version` int DEFAULT NULL COMMENT '版本',
  `deleted` int DEFAULT NULL COMMENT '逻辑删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='模板字段';

-- ----------------------------
-- Records of t_code_template_field
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_code_template_file
-- ----------------------------
DROP TABLE IF EXISTS `t_code_template_file`;
CREATE TABLE `t_code_template_file` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `template_id` int DEFAULT NULL COMMENT '模板id',
  `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '文件名',
  `file` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '文件内容',
  `file_type` varchar(50) DEFAULT NULL COMMENT '文件类型',
  `file_path` varchar(255) DEFAULT NULL COMMENT '文件相对路径',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user_id` int DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_user_id` int DEFAULT NULL COMMENT '修改人',
  `version` int DEFAULT NULL COMMENT '版本',
  `deleted` int DEFAULT NULL COMMENT '逻辑删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='模板文件内容\n';

-- ----------------------------
-- Records of t_code_template_file
-- ----------------------------
BEGIN;
INSERT INTO `t_code_template_file` (`id`, `template_id`, `file_name`, `file`, `file_type`, `file_path`, `create_time`, `create_user_id`, `update_time`, `update_user_id`, `version`, `deleted`) VALUES (1, 1, 'entity.ts', '// ${tableComment}\n\nexport default class ${className} extends BaseModel {\n<%\nfor(column in columns){\n%>\n  ${column.javaName}: ${strutil.toLowerCase(column.javaType)};\n<% } %>\n}', 'ts', 'src/api/entity', '2022-07-14 09:52:22', NULL, '2022-07-14 10:37:43', NULL, 0, 0);
INSERT INTO `t_code_template_file` (`id`, `template_id`, `file_name`, `file`, `file_type`, `file_path`, `create_time`, `create_user_id`, `update_time`, `update_user_id`, `version`, `deleted`) VALUES (3, 1, 'filter.ts', '// ${tableComment}\n\nexport default class ${className}Filter {\n<%\nfor(column in columns){\n%>\n  ${column.javaName}: ${strutil.toLowerCase(column.javaType)};\n<% } %>\n}', 'ts', 'src/api/entity/filter', '2022-07-14 10:01:18', NULL, '2022-07-14 10:37:43', NULL, 0, 0);
INSERT INTO `t_code_template_file` (`id`, `template_id`, `file_name`, `file`, `file_type`, `file_path`, `create_time`, `create_user_id`, `update_time`, `update_user_id`, `version`, `deleted`) VALUES (5, 1, 'controller.ts', '// ${tableComment}controller\n\nimport { Result, Request, PageInfo } from \'@/types/axios\';\nimport { erpRequest as request } from \'@/utils/request\';\nimport ${className}Filter from \'@/api/entity/filter/${className}Filter\';\nimport ${className} from \'@/api/entity/${className}Entity\';\n\nexport default class ${className}Controller {\n  static list = async (params: Request<${className}Filter>) => {\n    return request.post<Result<PageInfo<${className}>>>({ url: \'/${camelCaseName}/list\', params });\n  };\n\n  static view = (params) => {\n    return request.get<Result<${className}>>({ url: \'/${camelCaseName}/view\', params });\n  };\n\n  static add = (params: ${className}) => {\n    return request.post<Result<null>>({ url: \'/${camelCaseName}/add\', params });\n  };\n\n  static update = (params: ${className}) => {\n    return request.post<Result<null>>({ url: \'/${camelCaseName}/update\', params });\n  };\n\n  static delete = (params: { id: number }) => {\n    return request.post<Result<null>>({ url: \'/${camelCaseName}/delete\', params });\n  };\n}\n', 'ts', 'src/api/controller', '2022-07-14 10:13:00', NULL, '2022-07-14 10:37:43', NULL, 0, 0);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
